package socket.seversocket;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.net.UnknownHostException;

public class ClientThread extends Thread {

	@Override
	public void run() {
		try {
			//创建客户端Socket
			Socket sc=new Socket("10.96.114.22",1011);
			//客户端输出流 
			BufferedWriter os=new BufferedWriter(new OutputStreamWriter(sc.getOutputStream(),"utf-8"));
			String str ="我的名字叫郭俊池  \n";
			os.write(str);
			//客户端输出流没有进行关闭的时候需要设置结束语句，来判断结束
			os.write("yes\n");
			System.out.println("客户端发出请求");
			os.flush();
			//os.close();
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
